import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout/Index.vue'
// import { pa } from 'element-plus/es/locale'
//引入页面
// const Home = () => import('@/views/Home.vue')
const Login = () => import("@/views/login/Index.vue")
const PersonalIndex = () => import("@/views/personal/Index.vue")
const PersonalMessage = () => import("@/views/personal/Message.vue")
const AppIndex = () => import("@/views/app/Index.vue")
const NotFound = () => import("@/views/404.vue")

//路由配置



const routesConfig = [
  // {
  //   path: '/',
  //   component: Home
  // }
  {
    path:'/',
    name:'Home',
    component:Layout,
    children:[
      //登录页
      {
        path:'login',
        name:'Login',
        component:Login
      },
      //个人中心页
      {
        path:'personal',
        name:'Personal',
        component:PersonalIndex,
        children:[
          {
            path:'message',
            name:'PersonalMessage',
            component:PersonalMessage
          }
        ]
      },
      //app内部页
      {
        path:'app',
        name:'App',
        component:AppIndex
      },
      //404
      {
        path:'404',
        name:'NotFound',
        component:NotFound
      }
    ]
  },
  {
    path:'/:pathMatch(.*)*',
    name:'404',
    redirect:'/404'
  }
]

//初始化路由
const router = createRouter({
  history: createWebHashHistory(),
  routes: routesConfig
})

//对外暴露路由实例
export default router
